DEFINE CLASS datasocios as databaseclass 
	
	vapellido = ""
	vnombre = ""
	vemail = "" 
	vidsocio = 0
	vdomicilio = ""
	vnrosocio = 0
	vtelefono = ""
	
	FUNCTION insert as Boolean
		
		INSERT INTO socio (apellido, nombre, email, domicilio, nrosocio,telefono) ;
		VALUES (this.vapellido, this.vnombre, this.vemail, this.vdomicilio, this.vnrosocio, this.vtelefono)
		IF _TALLY > 0 then
		RETURN .T.
		ELSE
		RETURN .F.
		ENDIF
		
	ENDFUNC
	
	FUNCTION update AS Boolean
		
		update socio set ;
		apellido = this.vapellido, ;
		nombre = this.vnombre, ;
		email = this.vemail, ;
		domicilio = this.vdomicilio, ;
		nrosocio = this.vnrosocio, ;
		telefono = this.vtelefono ;
		where idsocio = this.vidsocio
		
		IF _TALLY > 0 then
		RETURN .T.
		ELSE
		RETURN .F.
		ENDIF
		
	endfunc
	
	FUNCTION delete AS Boolean
	PARAMETERS bidsocio
	delete from socio where idsocio = bidsocio
	
	IF _TALLY > 0 then
		RETURN .T.
		ELSE
		RETURN .F.
		ENDIF
	SET DELETED ON
	ENDFUNC
	
	FUNCTION deleteall AS Boolean
	DELETE from socio 
	
	IF _TALLY > 0 then
		RETURN .T.
		ELSE
		RETURN .F.
		ENDIF
	SET DELETED ON
	ENDFUNC
		
	FUNCTION getone as Boolean
		PARAMETERS bidsocio
		select * from socio where idsocio = bidsocio into cursor curSocBuscado
		
		this.vapellido = curSocBuscado.apellido
		this.vnombre = curSocBuscado.nombre
		this.vemail = curSocBuscado.email
		this.vidsocio = curSocBuscado.idsocio
		this.vdomicilio = curSocBuscado.domicilio
		this.vnrosocio = curSocBuscado.nrosocio
		this.vtelefono = curSocBuscado.telefono
		
		IF _TALLY > 0 then
		RETURN .T.
		ELSE
		RETURN .F.
		ENDIF
		
	ENDFUNC
	
	FUNCTION getall as Boolean
		
		SELECT * FROM socio INTO CURSOR vcursocios

		IF _TALLY > 0 then
		RETURN .T.
		ELSE
		RETURN .F.
		ENDIF
		

		
	ENDFUNC
	
	FUNCTION getmaxid as int
		SELECT socio
		CALCULATE MAX(idsocio) TO maxid
		RETURN maxid
		
	ENDFUNC

enddefine